define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'knscy.menus/index',
        add_url: 'knscy.menus/add',
        edit_url: 'knscy.menus/edit',
        delete_url: 'knscy.menus/delete',
        export_url: 'knscy.menus/export',
        modify_url: 'knscy.menus/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'ID'},
                    {field: 'sort', title: '排序',minWidth: 90,search: false, edit: 'text'},
                    {field: 'type_id', search: 'select', minWidth:150, selectList: {10:"首页导航",11:"底部导航" ,12:"其他"}, title: '类型'},

                    {field: 'title', minWidth:150,  title: '菜单名称', edit: 'text'},
                    {field: 'thumb', title: '默认图片',  minWidth: 100,  imageHeight: 25, search:false, templet: ea.table.image},
                    {field: 'thumb_hover', title: '选中图片',  minWidth: 100,  imageHeight: 25, search:false, templet: ea.table.image},
                    {field: 'open_url', title: '链接URL',minWidth: 200, edit: 'text'},
                    {field: 'link_type', search: 'select',minWidth: 120, selectList: ["内部页面","网页URL","小程序URL"], title: 'URL类型'},

                    {field: 'status', search: 'select',minWidth: 90, selectList: ["禁用","启用"], title: '状态', templet: ea.table.switch},
                    {field: 'create_time', title: '创建时间',search:'range', minWidth: 150},
                    {fixed:"right",width: 150, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});